#ifndef PLBYTEARRAY_H
#define PLBYTEARRAY_H

//Our includes
#include "plData.h"

class plByteArray : public plData {

public:
    //Constructor
    plByteArray();

    //Constructor
    plByteArray(char* value, int size);

    //Copy constructor
    plByteArray(const plByteArray& obj);

    //Deletes the data
    virtual ~plByteArray();

    //Accessor
    const char* Data();

    //Modifier
    void SetData(const char* value, int size);
    void SetRawData(char* value, int size);

    //Gets of the data in bytes
    int Size();

    //Operator overloading
    void operator=(const plByteArray& obj);

    operator const char*();

    //Binds the data with the statement
    virtual void Bind(sqlite3_stmt* statement, int index = 1) const;

    //Gets the data from the current statement
    virtual void Column(sqlite3_stmt* statement, int index = 0);

    //The classes name
    static const char* GetClassName() { return "plByteArray"; }

private:
    char* Value;
    int SizeInBytes; //Size in bytes of value
    bool OwnData; //True if we own the data, else someone else does, don't delete it

    //Does a smart copy of the object
    void Copy(const plByteArray& obj);
};

#endif // PLBYTEARRAY_H
